﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Demo01
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("请输入一行字符串：");
            string arr = Console.ReadLine();

            Console.WriteLine("你输入的字符串是："+arr);

            int Lettercount = 0;
            int Digitcount = 0;
            int WhiteSpace = 0;
            foreach (var item in arr)
            {
                if (char.IsLetter(item))
                {
                    Lettercount++;
                }
                if (char.IsDigit(item))
                {
                    Digitcount++;
                }
                if (char.IsWhiteSpace(item))
                {
                    WhiteSpace++;
                }
            }
            Console.WriteLine("你输入的字符串中,字母有{0}个,数字有{1}个,空格有{2}个",Lettercount, Digitcount, WhiteSpace);
        }
    }
}
